import request from '@/utils/request'

//统一管理接口
enum API {
  Primary_URL = '/product/attr/primary',
  Secondary_URL = '/product/attr/secondary',
  Reclassify_URL = '/product/attr/reclassify',
  PropertyData_URL = '/product/attr/propertyData',
}

/**
 * 获取一级分类
 */
export const getPrimary = () => request.get<any, any>(API.Primary_URL)

/**
 * 获取二级分类
 * @param name
 * @returns
 */
export const getSecondary = (id: number) =>
  request.get<any, any>(API.Secondary_URL, { params: { id } })

/**
 * 获取三级分类
 * @param name
 * @returns
 */
export const getReclassify = (id: number) =>
  request.get<any, any>(API.Reclassify_URL, { params: { id } })

/**
 * 获取属性数据
 * @param name
 * @returns
 */
export const getPropertyData = (id: number) =>
  request.get<any, any>(API.PropertyData_URL, { params: { id } })
